﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


public class TweenActionBase
{
    public float totalTime = 0;
    private float passTime = 0;
    public bool first = true;

    public void Step(float delta)
    {
        if(first)
        {
            first = false;
            this.OnStart();
        }

        passTime += delta;
        float schedule;
        if (totalTime <= 0)
            totalTime = 0.01f;
        schedule = Math.Min(1.0f, passTime / totalTime);
        this.OnUpdate(schedule);
    }
    public virtual void OnStart()
    {

    }

    public virtual void OnUpdate(float schedule)
    {

    }

    public virtual bool IsEnded()
    {
        return passTime > totalTime;
    }

}

